<template>
	<section class="warnDetail1" @click="treeBlurHide">
   	  	<el-form label-position="top" :inline="true" v-model="filter" class="demo-form-inline">
            <el-row>
                <el-col :span="4">
                    <el-form-item label="品牌名称:">
                        <el-autocomplete
					      class="inline-input"
					      v-model="filter.brandName"
					      :fetch-suggestions="querySearch"
					      placeholder="请选择品牌名称"
					      @select="handleSelect"
					      size="small"
					    ></el-autocomplete>
                    </el-form-item>
                </el-col>
                <el-col :span="4">
                    <el-form-item label="sku关键词:">
                        <el-autocomplete
					      class="inline-input"
					      v-model="filter.keyword"
					      :fetch-suggestions="querySearchSku"
					      :trigger-on-focus="false"
					      placeholder="请选择sku关键词"
					      @select="handleSelectSku"
					      size="small"
					    ></el-autocomplete>
                    </el-form-item>
                </el-col>
                <el-col :span="4">
                    <el-form-item label="商品标题:">
                        <el-input placeholder="商品标题" v-model="filter.title" size="small"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="4">
                    <el-form-item label="平台:">
                        <el-input icon="caret-bottom" v-model="category.name" placeholder="选择搜索平台"  size="small"></el-input>
                    	<div @click.stop="category.showTree=!category.showTree" class="treeStyle">
                    		<div v-show="category.showTree" class="department-tree-select inline-tree" >
	                    	    <el-tree :data="category.data"
	                                style=""
	                                show-checkbox
	                                node-key="id"
	                                default-expand-all
	                                ref="searchTree"
	                                @check-change="handleCheckChange"
	                                :props="defaultProps">
	                            </el-tree>
                            </div>
                       </div>
                    </el-form-item>
                </el-col> 
            </el-row>
            <el-row>
                <el-col :span="24" class="action_col">
                    <el-form-item class="action_button_group_open">
                        <el-button size="small" type="primary" @click="empty"><i class="fa fa-trash-o fa-lg"></i> 清空筛选条件
                        </el-button>
                        <el-button size="small" type="primary" @click="submitSearch()" icon="el-icon-search">查询</el-button>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
		        <a size="small"  @click="exportTable1('table1')" class="export1">
		        	<el-button size="small" icon="el-icon-zoom-in">导出</el-button>
		        </a>
		    </el-row>
            <el-row class="margin-table">
                <el-table :data="tableData1"  @selection-change="handleSelectionChange" border>
					<el-table-column  type="selection"  width='50' align='center'></el-table-column>
					<el-table-column prop="brandName" label="品牌名称" width="200" fixed='left' align='center'></el-table-column>
					<el-table-column prop="keywordName" label="sku关键词" width="180" align='center'></el-table-column>
					<el-table-column prop="goodsTitle" label="商品标题" width="233" align='center'>
						<template scope="scope">
							<a :href="scope.row.goodsUrl" class="a-title" target="_blank">{{ scope.row.goodsTitle}}</a>	
						</template>
					</el-table-column>
					<el-table-column prop="platText" label="平台" width="113" align='center'></el-table-column>
					<el-table-column prop="pcPrice" label="pc端单价（元）" width="210" align='center'>
						<template scope="scope" >
							<div v-if="scope.row.pcPriceIncrement">
								<span>{{scope.row.pcPrice}}</span><br />
								<span>低于标准价金额：{{scope.row.pcPriceIncrement}}</span>
							</div>
						</template>
					</el-table-column> 			    
					<el-table-column prop="appPrice" label="app端单价（元）" width="210" align='center'>
						<template scope="scope" >
							<div v-if="scope.row.appPriceIncrement">
								<span>{{scope.row.appPrice}}</span><br />
								<span>低于标准价金额：{{scope.row.appPriceIncrement}}</span>
							</div>
						</template>
					</el-table-column> 
					<el-table-column prop="authorizedOrNot" label="是否授权" width="100" align='center'></el-table-column>
					<el-table-column prop="shopName" label="店铺名称" width="145" align='center'></el-table-column>
					<el-table-column prop="address" label="地址" width="141" align='center'></el-table-column>
					<el-table-column prop="salesCount" label="销售量" width="120" align='center'></el-table-column>
					<el-table-column prop="shopIm" label="店铺旺旺号" width="145" align='center'></el-table-column>     
					<el-table-column prop="shopCredit" label="店铺信誉" width="105" align='center'>
						<template scope="scope" >
							<span v-if="scope.row.shopCredit<=5 && scope.row.shopCredit>0 && scope.row.platText!='京东'">
								{{scope.row.shopCredit}}星
							</span>
							<span v-if="scope.row.shopCredit>5 && scope.row.shopCredit<=10 && scope.row.platText!='京东'">
								{{scope.row.shopCredit-5}}钻
							</span>
							<span v-if="scope.row.shopCredit>10 && scope.row.shopCredit<=15 && scope.row.platText!='京东'">
								{{scope.row.shopCredit-10}}皇冠
							</span>
							<span v-if="scope.row.shopCredit>15 && scope.row.shopCredit<=20 && scope.row.platText!='京东'">
								{{scope.row.shopCredit-15}}金冠
							</span>
							<span v-if="scope.row.shopCredit>20 && scope.row.platText!='京东'">
								5金冠
							</span>
							<span v-if=" scope.row.platText=='京东' && scope.row.shopCredit!=null">
								{{scope.row.shopCredit/100}}
							</span>
						</template>
					</el-table-column>
					<el-table-column label="店铺动态评分" width="230" align='center'>
						<template scope="scope" >
							<div style="line-height: 20px;padding: 10px 0;text-align:left">
								<span v-if="scope.row.goodsDescGrade">描述相符{{scope.row.goodsDescGrade}}</span>
								<span style="margin-left: 15px;">
									<span v-if="scope.row.goodsDescRateCode==1" class="highScore">高于{{scope.row.goodsDescRate}}%</span>
									<span v-if="scope.row.goodsDescRateCode==2" class="downScore">低于{{scope.row.goodsDescRate}}%</span>
									<span v-if="scope.row.goodsDescRateCode==0" class="pingScore">{{scope.row.goodsDescRate}}</span>
									<span v-if="scope.row.goodsDescRateCode==-1">{{scope.row.goodsDescRate}}</span>
								</span>
								<br />
								<span v-if="scope.row.serviceGrade">服务态度{{scope.row.serviceGrade}}</span>
								<span style="margin-left: 15px;">
									<span v-if="scope.row.serviceRateCode==1" class="highScore">高于{{scope.row.serviceRate}}%</span>
									<span v-if="scope.row.serviceRateCode==2" class="downScore">低于{{scope.row.serviceRate}}%</span>
									<span v-if="scope.row.serviceRateCode==0" class="pingScore">{{scope.row.serviceRate}}</span>
									<span v-if="scope.row.serviceRateCode==-1">{{scope.row.serviceRate}}</span>
								</span>
								<br />
								<span v-if="scope.row.logisticsGrade">物流服务{{scope.row.logisticsGrade}}</span>
								<span style="margin-left: 15px;">
									<span v-if="scope.row.logisticsRateCode==1" class="highScore">高于{{scope.row.logisticsRate}}%</span>
									<span v-if="scope.row.logisticsRateCode==2" class="downScore">低于{{scope.row.logisticsRate}}%</span>
									<span v-if="scope.row.logisticsRateCode==0" class="pingScore">{{scope.row.logisticsRate}}</span>
									<span v-if="scope.row.logisticsRateCode==-1">{{scope.row.logisticsRate}}</span>
								</span>
							</div>
						</template>
					</el-table-column>  
					<el-table-column prop="evaluateRate" label="好评率" width="123" align='center'>
						<template scope="scope" >
							<span v-if="scope.row.evaluateRate">{{scope.row.evaluateRate}}%</span>
						</template>
					</el-table-column>
					<el-table-column prop="logisticsPrice" label="运费" width="123" align='center'></el-table-column>
					<el-table-column prop="updateTimeString" label="创建时间" width="180" align='center'></el-table-column>
			    </el-table>
            </el-row>
            <el-row >
		        <el-pagination
		          class="maT-40"
                  @current-change="handleCurrentChange"
                  @size-change="handleSizeChange"
                  :current-page="currentPage"
                  :page-sizes="[10, 20, 50,1000]"
                  :page-size="pageSize"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="totalCount">
		        </el-pagination> 
      		</el-row>
      		<el-row class="margin-table1">
                <el-table :data="tableDataCheckFack" id="table1" border>
					<el-table-column  type="selection"  width='50' align='center'></el-table-column>
					<el-table-column prop="brandName" label="品牌名称" width="200" align='center'></el-table-column>
					<el-table-column prop="keywordName" label="sku关键词" width="180" align='center'></el-table-column>
					<el-table-column prop="goodsTitle" label="商品标题" width="233" align='center'>
						<template scope="scope">
							<a :href="scope.row.goodsUrl" class="a-title">{{ scope.row.goodsTitle}}</a>	
						</template>
					</el-table-column>
					<el-table-column prop="goodsUrl" label="商品Url" width="233" align='center'>
						<template scope="scope">
							<a :href="scope.row.goodsUrl" target="_blank">{{ scope.row.goodsUrl}}</a>
						</template>
					</el-table-column>
					<el-table-column prop="platText" label="平台" width="113" align='center'></el-table-column>
					<el-table-column prop="pcPrice" label="pc端单价（元）" width="210" align='center'>
						<template scope="scope" >
							<div v-if="scope.row.pcPriceIncrement">
								<span>{{scope.row.pcPrice}}</span><br />
								<span>低于标准价金额：{{scope.row.pcPriceIncrement}}</span>
							</div>
						</template>
					</el-table-column> 			    
					<el-table-column prop="appPrice" label="app端单价（元）" width="210" align='center'>
						<template scope="scope" >
							<div v-if="scope.row.appPriceIncrement">
								<span>{{scope.row.appPrice}}</span><br />
								<span>低于标准价金额：{{scope.row.appPriceIncrement}}</span>
							</div>
						</template>
					</el-table-column> 
					<el-table-column prop="authorizedOrNot" label="是否授权" width="100" align='center'></el-table-column>
					<el-table-column prop="shopName" label="店铺名称" width="145" align='center'></el-table-column>
					<el-table-column prop="address" label="地址" width="141" align='center'></el-table-column>
					<el-table-column prop="salesCount" label="销售量" width="120" align='center'></el-table-column>
					<el-table-column prop="shopIm" label="店铺旺旺号" width="145" align='center'></el-table-column>     
					<el-table-column prop="shopCredit" label="店铺信誉" width="105" align='center'>
						<template scope="scope" >
							<span v-if="scope.row.shopCredit<=5 && scope.row.shopCredit>0 && scope.row.platText!='京东'">
								{{scope.row.shopCredit}}星
							</span>
							<span v-if="scope.row.shopCredit>5 && scope.row.shopCredit<=10 && scope.row.platText!='京东'">
								{{scope.row.shopCredit-5}}钻
							</span>
							<span v-if="scope.row.shopCredit>10 && scope.row.shopCredit<=15 && scope.row.platText!='京东'">
								{{scope.row.shopCredit-10}}皇冠
							</span>
							<span v-if="scope.row.shopCredit>15 && scope.row.shopCredit<=20 && scope.row.platText!='京东'">
								{{scope.row.shopCredit-15}}金冠
							</span>
							<span v-if="scope.row.shopCredit>20 && scope.row.platText!='京东'">
								5金冠
							</span>
							<span v-if=" scope.row.platText=='京东' && scope.row.shopCredit!=null">
								{{scope.row.shopCredit/100}}
							</span>
						</template>
					</el-table-column>
					<el-table-column label="店铺动态评分" width="230">
						<template scope="scope" >
							<div style="line-height: 20px;padding: 10px 0;text-align:left">
								<span v-if="scope.row.goodsDescGrade">描述相符{{scope.row.goodsDescGrade}}</span>
								<span style="margin-left: 15px;">
									<span v-if="scope.row.goodsDescRateCode==1" class="highScore">高于{{scope.row.goodsDescRate}}%</span>
									<span v-if="scope.row.goodsDescRateCode==2" class="downScore">低于{{scope.row.goodsDescRate}}%</span>
									<span v-if="scope.row.goodsDescRateCode==0" class="pingScore">{{scope.row.goodsDescRate}}</span>
									<span v-if="scope.row.goodsDescRateCode==-1">{{scope.row.goodsDescRate}}</span>
								</span>
								<br />
								<span v-if="scope.row.serviceGrade">服务态度{{scope.row.serviceGrade}}</span>
								<span style="margin-left: 15px;">
									<span v-if="scope.row.serviceRateCode==1" class="highScore">高于{{scope.row.serviceRate}}%</span>
									<span v-if="scope.row.serviceRateCode==2" class="downScore">低于{{scope.row.serviceRate}}%</span>
									<span v-if="scope.row.serviceRateCode==0" class="pingScore">{{scope.row.serviceRate}}</span>
									<span v-if="scope.row.serviceRateCode==-1">{{scope.row.serviceRate}}</span>
								</span>
								<br />
								<span v-if="scope.row.logisticsGrade">物流服务{{scope.row.logisticsGrade}}</span>
								<span style="margin-left: 15px;">
									<span v-if="scope.row.logisticsRateCode==1" class="highScore">高于{{scope.row.logisticsRate}}%</span>
									<span v-if="scope.row.logisticsRateCode==2" class="downScore">低于{{scope.row.logisticsRate}}%</span>
									<span v-if="scope.row.logisticsRateCode==0" class="pingScore">{{scope.row.logisticsRate}}</span>
									<span v-if="scope.row.logisticsRateCode==-1">{{scope.row.logisticsRate}}</span>
								</span>
							</div>
						</template>
					</el-table-column>  
					<el-table-column prop="evaluateRate" label="好评率" width="123" align='center'>
						<template scope="scope" >
							<span v-if="scope.row.evaluateRate">{{scope.row.evaluateRate}}%</span>
						</template>
					</el-table-column>
					<el-table-column prop="logisticsPrice" label="运费" width="123" align='center'></el-table-column>
					<el-table-column prop="updateTimeString" label="创建时间" width="180" align='center'>
						<template scope="scope" >
							<span>
								"{{scope.row.updateTimeString}}"
							</span>
						</template>
					</el-table-column>
			    </el-table>
            </el-row>
   	  	</el-form>
   </section>
</template>

<script>
	import Vue from 'vue'
	import {mapGetters} from 'vuex'
    import {Button, Tabs, TabPane, TableColumn, Form, Table, FormItem, Option, Select, Input,Pagination,Row, Col,Tree,Dialog,Message,MessageBox,Autocomplete} from 'element-ui'
	Vue.use(Tabs)
	Vue.use(Button)
	Vue.use(Select)
	Vue.use(Input)
	Vue.use(TabPane)
	Vue.use(Form)
	Vue.use(Option)
	Vue.use(FormItem)
	Vue.use(TableColumn)
	Vue.use(Table)
	Vue.use(Pagination)
	Vue.use(Row)
	Vue.use(Col)
	Vue.use(Row)
	Vue.use(Col)
	Vue.use(Tree)
	Vue.use(Dialog)
	Vue.use(Autocomplete)
	
	Vue.prototype.$message = Message;
	Vue.prototype.$confirm = MessageBox.confirm;
	
    export default{
		components: {
			
        },
        head(){
        	return {
                title: "预警明细列表",
                meta: [
                    { hid: 'detailList-warning1', name: 'detailList-warning1', content: 'detailList-warning1'}
                ]
            }
        },
        props:{
        	
        },
        data(){
        	return{
        		today:'',
        		tabName: '预警明细列表',
        		filter:{
	      			brandName:'',//品牌名称
	      			keyword:'',//keyword
	      			title:'', //商品标题
	      			platform:''//平台
			
      		    },
      		    brandSelectId:'',
        		brandSelectName:'',
        		SkuSelectId:'',
        		SkuSelectName:'',
      		    listData:[],
      		    skuList:[],
      		    checkTypes:[],
			    tableData1:[],
			    tableDataCheckFack:[],
			    currentPage:50,
	      		pageSize:1,
	      		totalCount:0,
		        defaultProps: {
                    children: 'children',
                    label: 'label',
                },
                category: {
                    name: '',
                    showTree: false,
                    data:[
	                    {
		                   	id:0,
		                   	label:'全部',
		                   	children: [{
					            id: 4,
					            label: '天猫'
					        }, {
					            id: 3,
					            label: '淘宝'
					        }, {
					            id: 1,
					            label: '京东'
					        }, {
					            id: 2,
					            label: '一号店'
					        }]
	                    }
                    ] 
                } 
        	}
        },
        computed : {
        	...mapGetters({
        	   'pageTabsList': 'getPageTabsList',
//             'currentPage': 'currentPageFakeDetail',
//             'totalCount': 'totalCountFakeDetail',
//             'pageSize': 'pageSizeFakeDetail',
            })
		},	
		mounted(){
			this.restaurants=this.loadAll();
//			this.restaurantsSku=this.loadAllSku();
			this.changeTabs();
			if(process.BROWSER_BUILD) {
                if(this.pageTabsList[this.pageTabsList.length-1].name == '预警明细列表') {
                    let arr = this.pageTabsList;
                    arr[arr.length-1].name = this.tabName;
                    this.$store.commit('PAGETABSLIST',{data:arr})
                }
            }
			if(this.$store.state.warning.todayFakeDetail0!={} && this.today==1){
				this.getStore(this.$store.state.warning.todayFakeDetail0)
            }
			if(this.$store.state.warning.todayFakeDetail1!={} && this.today==0){
				this.getStore(this.$store.state.warning.todayFakeDetail1)
            }
			this.getfakeListDetail();
		},
		watch:{
            $route(){
            	this.changeTabs();
            	if(this.today==1){
            		this.getStore(this.$store.state.warning.todayFakeDetail0)
            	}
            	if(this.today==0){
            		this.getStore(this.$store.state.warning.todayFakeDetail1)
            	}
            }
		},
		methods:{
			getStore(obj){
				this.brandSelectId = obj.brandSelectId4;
	            this.filter.brandName = obj.brandName4;
	            this.SkuSelectId=obj.SkuSelectId4;
	            this.filter.keyword = obj.keyword4;
	            this.filter.title = obj.title1;
	            this.checkTypes=obj.checkTypes4;
	            this.category.name=obj.categoryName4;
	            this.currentPage=obj.currentPageFakeDetail;
		    	this.pageSize=obj.pageSizeFakeDetail;
		    	this.totalCount=obj.totalCountFakeDetail;
			},
			setStore(obj){
				this.$store.commit(obj,{
	    			data:{
	    				brandSelectId4:this.brandSelectId,
		    			brandName4:this.filter.brandName,
		    			SkuSelectId4:this.SkuSelectId,
		    			keyword4:this.filter.keyword,
		    			title1:this.filter.title,
		    			checkTypes4:this.checkTypes,
		    			categoryName4:this.category.name,
		    			pageSizeFakeDetail :this.currentPage,
		    			pageSizeFakeDetail:this.pageSize,
		    			totalCountFakeDetail:this.totalCount
	    			}
	    		});
			},
    	    handleSelectionChange(val){//单选或全选
    	    	this.tableDataCheckFack=val;
//  	    	for(var i=0;i<this.tableDataCheckFack.length;i++){
//  	    		this.tableDataCheckFack[i].goodsUrl='http:'+this.tableDataCheckFack[i].goodsUrl
//  	    	}
    	    	if(this.tableDataCheckFack.length==0){
    	    		document.getElementsByClassName("export1")[0].removeAttribute('href');
    	    	}
    	    },
    	    exportTable1(tableid){//将表格内容导出到excel中
    	    	if(this.tableDataCheckFack.length==0){
					this.$message({type: 'error',message: '请先选择要导出的明细信息'});
					return false;
				}else{
	    	 		var html = "<html><head><meta charset='utf-8' /></head><body>" + document.getElementById(tableid).outerHTML + "</body></html>";
	    	 		// 实例化一个Blob对象，其构造函数的第一个参数是包含文件内容的数组，第二个参数是包含文件类型属性的对象
			        var blob = new Blob([html], { type: "application/vnd.ms-excel" });
			        var a = document.getElementsByClassName("export1")[0];
			        // 利用URL.createObjectURL()方法为a元素生成blob URL
			        a.href = URL.createObjectURL(blob);
			        // 设置文件名，目前只有Chrome和FireFox支持此属性
			        if(this.today==1){
				    	a.download = "今日预警明细列表-假货.xls";
				    }else{
				    	a.download = "历史预警明细列表-假货.xls";
				    }
		       }
    	    },
			querySearch(queryString, cb) {
		        var restaurants = this.restaurants;
		        var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
		        // 调用 callback 返回建议列表的数据
		        cb(results);
		    },
		    querySearchSku(queryString, cb){
                if(queryString != "" && queryString != " "){
                    var params = {kwName: queryString}
                    this.$store.dispatch("getKeywordsListwarn",params).then((res)=>{
                        if(res && res.data.successed){
                            let list = res.data.data;
                            list.forEach((n,i)=>{
                                n.value = n.value
                            });
                            cb(list);
                        }
	                })
                }
            },
		    createFilter(queryString) {
		        return (restaurant) => {
		          return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
		        };
		    },
		    loadAll(){//模糊搜索品牌名称
		    	this.$store.dispatch("getRightsBrandsList").then(res=>{
            		if(res && res.data.successed){
            			var list=res.data.data;
		      		    for(let i=0,len=list.length;i<len;i++ ){
		      		    	this.listData[i]={};
		      		    	this.listData[i].value=list[i].brandName;
		      		    	this.listData[i].id=list[i].id.toString();
		      		    }
	      		    }
	    		}).catch((error) => {})
            	return this.listData
		    },
		    handleSelect(item){//获取当前选中的品牌信息	
		    	this.brandSelectId=item.id;
		    	this.brandSelectName=item.value;
		    },
		    handleSelectSku(item){//获取当前选中的sku信息	
		    	this.SkuSelectId=item.id;
		    	this.SkuSelectName=item.value;
		    },
		    handleSizeChange(val) {
		    	this.pageSize=val;
                if(this.today==1){ 
                	this.setStore('FAKE_TODAY_DATA_DETAIL')
                }
                if(this.today==0){ 
                	this.setStore('FAKE_HISTORY_DATA_DETAIL')
                }
				this.getfakeListDetail()
		    },
		    handleCurrentChange(val) {
		    	this.currentPage=val;
		    	if(this.today==1){ 
                	this.setStore('FAKE_TODAY_DATA_DETAIL')
                }
                if(this.today==0){ 
                	this.setStore('FAKE_HISTORY_DATA_DETAIL')
                }
		    	this.tableDataCheckFack=[];
		        this.getfakeListDetail()
		    },
		    //清空筛选条件
            empty(){
	    		this.filter = {
	    			brandName:'',//品牌名称
	      			keyword:'',//keyword
	      			title:'', //商品标题
	      			platform:''//平台
	    		}
	    		this.category.name='';
	    		this.$refs.searchTree.setCheckedKeys([]);
	    		if(this.today==1){this.$store.commit('FAKE_TODAY_DATA_DETAIL',{data:{}});}
                if(this.today==0){this.$store.commit('FAKE_HISTORY_DATA_DETAIL',{data:{}});}
	    	},
	    	changeOptionName(id){
    	    	switch(id){
    	    		case 4:return '天猫';break;
    	    		case 3:return '淘宝';break;
                    case 1:return '京东';break; 
                    case 2:return '1号店';break;
    	    	}
    	    },
    	    //隐藏客户分类
            treeBlurHide(){
                this.category.showTree = false;
            },
    	    handleCheckChange(data,checked) {
                this.category.name ='';
                var checkedId = this.$refs.searchTree.getCheckedKeys(data,true);
                this.checkTypes=checkedId;
                this.checkTypes=this.checkTypes.join(',')
                var checkedName = [];
                if(checkedId.length == this.category.data[0].children.length) {
                    this.category.name = '全部'
                }else {
                    for(var i=0;i<checkedId.length;i++){
                        checkedName.push(this.changeOptionName(checkedId[i]));
                    }
                    this.category.name = checkedName.join(' / ');
                }
            },	
            submitSearch(){
	    		this.getfakeListDetail();
	    		if(this.today==1){
		    		this.setStore('FAKE_TODAY_DATA_DETAIL')
	    		}
	    		if(this.today==0){
	    			this.setStore('FAKE_HISTORY_DATA_DETAIL')
	    		}
	    	},
	    	//查询获取列表
	    	getfakeListDetail(){
	    		if(this.filter.brandName==''){
                	this.brandSelectId=''
                }
	    		if(this.brandSelectId){//避免品牌名称选中后更改问题
	    			if(this.filter.brandName!=this.brandSelectName){ this.brandSelectId =''}
	    		}
	    		if(this.SkuSelectId){//避免关键词选中后更改问题
	    			if(this.filter.keyword!=this.SkuSelectName){ this.SkuSelectId=''}
	    		}
    			this.$store.dispatch("getSkuLowDetailswarn",{
    				today:this.today,
    				lowOrFake:0,
    				brandId:this.brandSelectId,
    				brandNameLike:this.filter.brandName,
    				keywordsId:this.SkuSelectId,
    				keywordsNameLike:this.filter.keyword,
    				goodsTitleLike:this.filter.title,
    				platTypes:this.checkTypes,
    				pageNum: this.currentPage,
            		pageSize: this.pageSize
    			}).then(res=>{
    				if(res && res.data.successed){
    					var result=res.data;
    					this.totalCount=result.data.total;
	  					this.tableData1=result.data.list;
    				}
    			}).catch((error) => {
    				this.tableData1=[];
    				this.totalCount=0;
    			})
    	    },
    	    changeTabs(){
		    	let url = window.location.href;
		        url = url.substring(url.lastIndexOf("="));
		        let tab = url.charAt(2);
		        if(tab==''){
		        	this.today=1
		        	this.tabName='今日预警明细列表'
		        }else{
		        	this.today=0
		        	this.tabName='历史预警明细列表'
		        }
		    }
    	    
		},
		updated(){
			
        },
		created () {
            
//          this.brandSelectId = this.$store.state.warning.brandSelectId4;
//          this.filter.brandName = this.$store.state.warning.brandName4;
//          this.SkuSelectId=this.$store.state.warning.SkuSelectId4;
//          this.filter.keyword = this.$store.state.warning.keyword4;
//          this.filter.title = this.$store.state.warning.title1;
//          this.checkTypes=this.$store.state.warning.checkTypes4;
//          this.category.name=this.$store.state.warning.categoryName4;
            if(process.BROWSER_BUILD) {
                if(this.pageTabsList[this.pageTabsList.length-1].name == 'CRM') {
                    let arr = this.pageTabsList;
                    arr[arr.length-1].name = this.tabName;
                    this.$store.commit('PAGETABSLIST',{data:arr})
                }
            }
        }
	}
</script>

<style lang="scss">
	.warnDetail1{
		.el-form-item {
            width: 70%
        }
		.el-table__empty-block{width: 100% !important;}
		margin-top:20px;
	    .maT-40{margin-top:40px;}
	    .el-tree-node__content{padding-left: 0 !important;}
		.treeStyle{
			position: absolute;top:3px;left:0;z-index: 10;
			width: 100%;height: 30px;
		}
		.a-title{display: inline-block;line-height: 20px;padding: 10px 0;}
		.margin-table{margin-top: 20px;}
		.margin-table1{z-index: 0 !important;opacity: 0;height:0 !important;overflow: hidden;}
		/*a.export1{
			width: 66px;height:26px;display: inline-block;
			font-size: 12px;border-radius: 4px;line-height: 26px;
			text-align: center;border: 1px solid #bfcbd9;color: #1f2d3d;
		}*/
	}
</style>